import os

from openai import OpenAI

# Qwen3 的密钥
QWEN3_API_KEY = os.getenv("QWEN3_API_KEY")
# Qwen3 的对应的服务地址
QWEN3_API_BASE_URL = "http://140.xxx.92.yy:27928/v1/"


def call_qwen3():
    """
    调用 Qwen3 大语言模型
    :return:
    """
    client = OpenAI(api_key=QWEN3_API_KEY, base_url=QWEN3_API_BASE_URL)

    model = "/data/modelscoope/models/Qwen/Qwen3-4B"
    messages = [
        {"role": "system", "content": "You are a helpful assistant"},
        {"role": "user", "content": "杭州有哪些核心竞争能力？"},
    ]

    response = client.chat.completions.create(
        model=model,
        messages=messages,
        stream=False
    )

    print(response.choices[0].message.content)


if __name__ == '__main__':
    call_qwen3()
